package com.tang.dubbo.contoller;

import com.tang.dubbo.IDemoService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/demo",produces = "application/json")
@RequiredArgsConstructor
public class DemoController {
    private final IDemoService demoService;

    @GetMapping
    public String sayHello(@RequestParam("name") String name){
        return demoService.sayHello(name);
    }

    @GetMapping("/random")
    public List<String> random(){
        return demoService.random();
    }
}
